<template>
  <div class="app-container">
    <el-card class="operate-container" shadow="never">
      <i class="el-icon-tickets"></i>
      <span>交易控制</span>
    </el-card>
    <div class="form-panel">
        <el-form :model="dataObject" :rules="rules" ref="adminForm" label-width="170px" size="small">
          <el-form-item :label="item.label"  v-for="item in list" :key="item.id">
            <el-input v-model="item.itemValue" :placeholder="`请输入${item.label}`" clearable></el-input>
          </el-form-item>
        </el-form>
    </div>
    <div class="form-btns"><el-button type="primary" @click="handleSubmit('adminForm')" size="mini">保存配置</el-button></div>
 
  </div>
</template>
<script>
import { createNamespacedHelpers } from "vuex";
const { mapState } = createNamespacedHelpers("transaction");
import { systemConfigList,updateSystemConfig } from "@/api/transaction";


export default {
  computed: {
    ...mapState({
      rules: state => state.rules
    })
  },
  data() {
    return {
       list:[],
       dataObject:{}
    }
  },
  created() {
    this.getLoad();
  },
 
  methods: {
    //初始化
    getLoad() {
      this.listLoading = true;
      systemConfigList().then(response => {
        this.list = response.data || [];
      });
    },
    //保存配置
    handleSubmit() {
      updateSystemConfig({list:this.list}).then(response => {
        this.$message({
          type: 'success',
          message: `更新成功!`
        });
      });
    
    },
  }
}
</script>
<style></style>